package jmine.tec.scheduling.domain;

import bancosys.tec.persist.builders.AbstractDBBuilder;

/**
 * @author lundberg
 */
public class ScheduledTaskBuilder extends AbstractDBBuilder<ScheduledTask> {

    private ScheduledTask task = this.createBean(ScheduledTask.class);

    public static ScheduledTaskBuilder aTask() {
        ScheduledTaskBuilder builder = new ScheduledTaskBuilder();
        builder.mnemonic("mnemonic");
        builder.description("description");
        builder.action("noOperationAction");
        builder.condition("alwaysExecuteCondition");
        builder.active(true);
        builder.cron("0 0/5 14 * * ?");
        builder.version(0L);
        return builder;
    }

    @Override
    protected ScheduledTask doBuild() {
        return this.task;
    }

    public ScheduledTaskBuilder id(Long value) {
        this.task.setId(value);
        return this;
    }

    public ScheduledTaskBuilder version(Long value) {
        this.task.setVersion(value);
        return this;
    }

    public ScheduledTaskBuilder mnemonic(String value) {
        this.task.setMnemonic(value);
        return this;
    }

    public ScheduledTaskBuilder description(String value) {
        this.task.setDescription(value);
        return this;
    }

    public ScheduledTaskBuilder active(Boolean value) {
        this.task.setActive(value);
        return this;
    }

    public ScheduledTaskBuilder cron(String value) {
        this.task.setCron(value);
        return this;
    }

    public ScheduledTaskBuilder condition(String value) {
        this.task.setCondition(value);
        return this;
    }

    public ScheduledTaskBuilder action(String value) {
        this.task.setAction(value);
        return this;
    }

}
